<!DOCTYPE html>
<!--
  Copyright 2016 Google Inc.

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
-->
<html>
  <head>
    <meta charset="utf-8">
    <title>Menu - Material Components Catalog</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/png" href="/images/logo_components_color_2x_web_48dp.png">
    <link rel="stylesheet" href="/assets/menu.css">
    <script src="/ready.js"></script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  </head>
  <body class="mdc-typography">
  <header class="mdc-toolbar mdc-toolbar--fixed demo-header-toolbar">
    <div class="mdc-toolbar__row">
      <section class="mdc-toolbar__section mdc-toolbar__section--align-start">
        <a href="/" class="catalog-back mdc-toolbar__menu-icon"><i class="material-icons">&#xE5C4;</i></a>
        <span class="mdc-toolbar__title catalog-title">Menu</span>
      </section>
      <section class="mdc-toolbar__section mdc-toolbar__section--align-end mdc-toolbar__section--shrink-to-fit">
        <button id="overflow-icon" class="material-icons mdc-icon-button">more_vert</button>
      </section>
    </div>
  </header>

    <main>
      <div class="mdc-toolbar-fixed-adjust"></div>
      <section class="hero">
        <div class="mdc-menu mdc-menu-surface mdc-menu-surface--open">
          <ul class="mdc-list">
            <li class="mdc-list-item" role="menuitem">
              <span class="mdc-list-item__text">
                Item 1
              </span>
            </li>
            <li class="mdc-list-item" role="menuitem">
              <span class="mdc-list-item__text">
                Item 2
              </span>
            </li>
            <li class="mdc-list-item mdc-list-item--disabled" role="menuitem">
              <span class="mdc-list-item__text">
                Item 3
              </span>
            </li>
            <li class="mdc-list-item" role="menuitem">
              <span class="mdc-list-item__text">
                Item 4
              </span>
            </li>
            <li class="mdc-list-item" role="menuitem">
              <span class="mdc-list-item__text">
                Item 5
              </span>
            </li>
          </ul>
        </div>
      </section>
      <div class="demo-content">
        <div id="demo-wrapper">
          <div class="mdc-menu-surface--anchor" style="top: 0; left: 0;">
            <button id="menu-button" class="mdc-button mdc-button--raised demo-button demo-button--normal">
              <span>
                Show Selection Group Menu
              </span>
            </button>

            <div class="mdc-menu mdc-menu-surface" tabindex="-1" id="demo-menu">
              <ul class="mdc-list" role="menu" aria-hidden="true" aria-orientation="vertical">
                <li>
                  <ul class="mdc-menu__selection-group">
                    <li class="mdc-list-item" role="menuitem">
                      <span class="mdc-menu__selection-group-icon">
                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                          <path fill="none" d="M0 0h24v24H0z"/>
                          <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
                        </svg>
                      </span>
                      <span class="mdc-list-item__text">
                        Single
                      </span>
                    </li>
                    <li class="mdc-list-item mdc-list-item--disabled" role="menuitem">
                      <span class="mdc-menu__selection-group-icon">
                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                          <path fill="none" d="M0 0h24v24H0z"/>
                          <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
                        </svg>
                      </span>
                      <span class="mdc-list-item__text">
                        1.15
                      </span>
                    </li>
                    <li class="mdc-list-item" role="menuitem">
                      <span class="mdc-menu__selection-group-icon">
                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                          <path fill="none" d="M0 0h24v24H0z"/>
                          <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
                        </svg>
                      </span>
                      <span class="mdc-list-item__text">
                        Double
                      </span>
                    </li>
                    <li class="mdc-list-item mdc-menu-item--selected" role="menuitem">
                      <span class="mdc-menu__selection-group-icon">
                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                          <path fill="none" d="M0 0h24v24H0z"/>
                          <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
                        </svg>
                      </span>
                      <span class="mdc-list-item__text">
                        Custom: 1.2
                      </span>
                    </li>
                  </ul>
                </li>
                <li class="mdc-list-divider" role="separator"></li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Add space before paragraph
                  </span>
                </li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Add space after paragraph
                  </span>
                </li>
                <li class="mdc-list-divider" role="separator"></li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Custom spacing...
                  </span>
                </li>
              </ul>
            </div>
          </div>

          <div class="mdc-menu-surface--anchor" style="top: 0; right: 0;">
            <button id="menu-button-2" class="mdc-button mdc-button--raised demo-button demo-button--normal">
              <span>
                Show Hot Key Menu
              </span>
            </button>

            <div class="mdc-menu mdc-menu-surface" tabindex="-1" id="demo-menu-2">
              <ul class="mdc-list" role="menu" aria-hidden="true" aria-orientation="vertical">
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__graphic" aria-hidden="true">
                    <svg style="width: 24px; height: 24px;" viewBox="0 0 24 24">
                      <path d="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z"></path>
                    </svg>
                  </span>
                  <span class="mdc-list-item__text">
                    Cut
                  </span>
                  <span class="mdc-list-item__meta" aria-label="Shortcut: Command Key + X">⌘X</span>
                </li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__graphic" aria-hidden="true">
                    <svg style="width: 24px; height: 24px;" viewBox="0 0 24 24">
                      <path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path>
                    </svg>
                  </span>
                  <span class="mdc-list-item__text">
                    Copy
                  </span>
                  <span class="mdc-list-item__meta" aria-label="Shortcut: Command Key + C">⌘C</span>
                </li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__graphic" aria-hidden="true">
                    <svg style="width: 24px; height: 24px;" viewBox="0 0 24 24">
                      <path d="M19,20H5V4H7V7H17V4H19M12,2A1,1 0 0,1 13,3A1,1 0 0,1 12,4A1,1 0 0,1 11,3A1,1 0 0,1 12,2M19,2H14.82C14.4,0.84 13.3,0 12,0C10.7,0 9.6,0.84 9.18,2H5A2,2 0 0,0 3,4V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V4A2,2 0 0,0 19,2Z"></path>
                    </svg>
                  </span>
                  <span class="mdc-list-item__text">
                    Paste
                  </span>
                  <span class="mdc-list-item__meta" aria-label="Shortcut: Command Key + P">⌘P</span>
                </li>
                <li class="mdc-list-divider" role="separator"></li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__graphic material-icons" aria-hidden="true">cloud</span>
                  <span class="mdc-list-item__text">
                    Web Clipboard
                  </span>
                </li>
              </ul>
            </div>


            <div class="mdc-menu mdc-menu-surface" tabindex="-1" id="demo-menu-3">
              <ul class="mdc-list" role="menu" aria-hidden="true" aria-orientation="vertical">
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Info
                  </span>
                </li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Slideshow
                  </span>
                </li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Loop video
                  </span>
                  <div class="mdc-list-item__meta">
                    <div class="mdc-checkbox">
                      <input type="checkbox"
                             class="mdc-checkbox__native-control"
                             id="loop-video-box"/>
                      <div class="mdc-checkbox__background">
                        <svg class="mdc-checkbox__checkmark"
                             viewBox="0 0 24 24">
                          <path class="mdc-checkbox__checkmark-path"
                                fill="none"
                                d="M1.73,12.91 8.1,19.28 22.79,4.59"></path>
                        </svg>
                        <div class="mdc-checkbox__mixedmark"></div>
                      </div>
                    </div>
                  </div>
                </li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Save to device
                  </span>
                </li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Add to album
                  </span>
                </li>
                <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__text">
                    Archive
                  </span>
                </li>
              </ul>
            </div>

          </div>
        </div>

        <div class="demo-controls-container">
          <div class="demo-controls">
            <div class="right-column-controls">
              Default Menu Position:
              <div>
                <label><input type="radio" name="menu-position" value="top start" checked> Top start</label>
              </div>

              <div>
                <label><input type="radio" name="menu-position" value="top end"> Top end</label>
              </div>

              <div>
                <label><input type="radio" name="menu-position" value="bottom start"> Bottom start</label>
              </div>

              <div>
                <label><input type="radio" name="menu-position" value="bottom end"> Bottom end</label>
              </div>
            </div>
            <p>
              Anchor Margins:
              <div id="margin-inputs" class="margin-inputs">
                <label>T: <input type="text" id="top-margin" value="0" size="3" max-length="3"></label>
                <label>B: <input type="text" id="bottom-margin" value="0" size="3"></label>
                <label>L: <input type="text" id="left-margin" value="0" size="3"></label>
                <label>R: <input type="text" id="right-margin" value="0" size="3"></label>
              </div>
            </p>
            <div>
              <label><input type="checkbox" name="is-rtl"> RTL</label>
            </div>
            <div>
              <label><input type="checkbox" name="animation"> Disable Open Animation</label>
            </div>
            <div>
              <label><input type="checkbox" name="right-click"> Enable Right Click Menu</label>
            </div>
            <hr>
            <div>
              <span>Last Selected item: <em id="last-selected">&lt;none selected&gt;</em></span>
            </div>
          </div>
        </div>
      </div>
    </main>

  <div class="mdc-menu mdc-menu-surface" tabindex="-1" id="demo-menu-4">
    <ul class="mdc-list" role="menu" aria-hidden="true" aria-orientation="vertical">
      <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__graphic" aria-hidden="true">
                    <svg style="width: 24px; height: 24px;" viewBox="0 0 24 24">
                      <path d="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z"></path>
                    </svg>
                  </span>
        <span class="mdc-list-item__text">
         Cut
        </span>
        <span class="mdc-list-item__meta" aria-label="Shortcut: Command Key + X">⌘X</span>
      </li>
      <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__graphic" aria-hidden="true">
                    <svg style="width: 24px; height: 24px;" viewBox="0 0 24 24">
                      <path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path>
                    </svg>
                  </span>
        <span class="mdc-list-item__text">
          Copy
        </span>
        <span class="mdc-list-item__meta" aria-label="Shortcut: Command Key + C">⌘C</span>
      </li>
      <li class="mdc-list-item" role="menuitem">
                  <span class="mdc-list-item__graphic" aria-hidden="true">
                    <svg style="width: 24px; height: 24px;" viewBox="0 0 24 24">
                      <path d="M19,20H5V4H7V7H17V4H19M12,2A1,1 0 0,1 13,3A1,1 0 0,1 12,4A1,1 0 0,1 11,3A1,1 0 0,1 12,2M19,2H14.82C14.4,0.84 13.3,0 12,0C10.7,0 9.6,0.84 9.18,2H5A2,2 0 0,0 3,4V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V4A2,2 0 0,0 19,2Z"></path>
                    </svg>
                  </span>
        <span class="mdc-list-item__text">
          Paste
        </span>
        <span class="mdc-list-item__meta" aria-label="Shortcut: Command Key + P">⌘P</span>
      </li>
      <li class="mdc-list-divider" role="separator"></li>
      <li class="mdc-list-item" role="menuitem">
        <span class="mdc-list-item__graphic material-icons" aria-hidden="true">cloud</span>
        <span class="mdc-list-item__text">
          Web Clipboard
        </span>
      </li>
    </ul>
  </div>

    <script src="/assets/material-components-web.js" async></script>
    <script>
      demoReady(function() {

        // Selection group menu
        var menuEl = document.getElementById('demo-menu');
        var menu = new mdc.menu.MDCMenu(menuEl);
        var menuButtonEl = document.getElementById('menu-button');
        menuButtonEl.addEventListener('click', function() {
          menu.open = !menu.open;
        });

        // Normal menu
        var menuEl2 = document.getElementById('demo-menu-2');
        var menu2 = new mdc.menu.MDCMenu(menuEl2);
        var menuButtonEl2 = document.getElementById('menu-button-2');
        menuButtonEl2.addEventListener('click', function() {
          menu2.open = !menu2.open;
        });

        // Hoisted menu
        var menuEl3 = document.getElementById('demo-menu-3');
        var menu3 = new mdc.menu.MDCMenu(menuEl3);
        var menuButtonEl3 = document.getElementById('overflow-icon');
        menu3.hoistMenuToBody();
        menu3.setAnchorElement(menuButtonEl3);
        menu3.setFixedPosition(true);
        menuButtonEl3.addEventListener('click', function() {
          menu3.open = !menu3.open;
        });

        // Right Click  menu
        var menuEl4 = document.getElementById('demo-menu-4');
        var menu4 = new mdc.menu.MDCMenu(menuEl4);
        menu4.hoistMenuToBody();
        menu4.setFixedPosition(true);

        var rightClickCheckbox = document.querySelector('input[name="right-click"]');

        // Right click callback function
        var contextMenuFunc = function(clickEvent) {
          menu4.setAbsolutePosition(clickEvent.clientX, clickEvent.clientY);
          menu4.open = true;
          clickEvent.preventDefault();
          return false;
        };

        // Right click checkbox listener
        rightClickCheckbox.addEventListener('change', function() {
          if (rightClickCheckbox.checked) {
            document.body.addEventListener('contextmenu', contextMenuFunc);
          } else {
            document.body.removeEventListener('contextmenu', contextMenuFunc);
          }
        });

        var animation = document.querySelector('input[name="animation"]');
        animation.addEventListener('change', function(evt) {
           menu.quickOpen = evt.target.checked;
           menu2.quickOpen = evt.target.checked;
           menu3.quickOpen = evt.target.checked;
           menu4.quickOpen = evt.target.checked;
        });

        var radios = document.querySelectorAll('input[name="menu-position"]');
        for (var i = 0; i < radios.length; i++) {
          radios[i].addEventListener('change', function(evt) {
            if (evt.target.checked) {
              switch (evt.target.value) {
                case "top start":
                  menu.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.TOP_START);
                  menu2.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.TOP_START);
                  menu3.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.TOP_START);
                  menu4.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.TOP_START);
                  break;
                case "bottom start":
                  menu.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.BOTTOM_START);
                  menu2.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.BOTTOM_START);
                  menu3.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.BOTTOM_START);
                  menu4.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.BOTTOM_START);
                  break;
                case "top end":
                  menu.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.TOP_END);
                  menu2.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.TOP_END);
                  menu3.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.TOP_END);
                  menu4.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.TOP_END);
                  break;
                case "bottom end":
                  menu.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.BOTTOM_END);
                  menu2.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.BOTTOM_END);
                  menu3.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.BOTTOM_END);
                  menu4.setAnchorCorner(mdc.menuSurface.MDCMenuSurfaceFoundation.Corner.BOTTOM_END);
                  break;
              }
            }
          });
        }

        var marginInputsEl = document.getElementById('margin-inputs');
        var inputs = marginInputsEl.querySelectorAll('input[type="text"]');
        for (var i = 0; i < inputs.length; i++) {
          inputs[i].addEventListener('change', function(evt) {
            var topMarginInput = document.getElementById('top-margin');
            var bottomMarginInput = document.getElementById('bottom-margin');
            var rightMarginInput = document.getElementById('right-margin');
            var leftMarginInput = document.getElementById('left-margin');
            var margin = {top: parseInt(topMarginInput.value, 10),
                          right: parseInt(rightMarginInput.value, 10),
                          bottom: parseInt(bottomMarginInput.value, 10),
                          left: parseInt(leftMarginInput.value, 10)};
            menu.setAnchorMargin(margin);
            menu2.setAnchorMargin(margin);
            menu3.setAnchorMargin(margin);
            menu4.setAnchorMargin(margin);
          });
        }

        var rtl = document.querySelector('input[name="is-rtl"]');
        rtl.addEventListener('change', function() {
          var demoWrapper = document.getElementById('demo-wrapper');
          if (rtl.checked) {
            demoWrapper.setAttribute('dir', 'rtl');
            menuEl3.setAttribute('dir', 'rtl');
            menuEl4.setAttribute('dir', 'rtl');
          } else {
            demoWrapper.removeAttribute('dir');
            menuEl3.removeAttribute('dir');
            menuEl4.removeAttribute('dir');
          }
        });

        var lastSelected = document.getElementById('last-selected');
        menuEl.addEventListener('MDCMenu:selected', function(evt) {
          var detail = evt.detail;
          lastSelected.textContent = 'Selection Group Menu: "' + detail.item.textContent.trim() +
            '" at index ' + detail.index;
        });

        menuEl2.addEventListener('MDCMenu:selected', function(evt) {
          var detail = evt.detail;
          lastSelected.textContent = 'Hot Key Menu: "' + detail.item.textContent.trim() +
            '" at index ' + detail.index;
        });

        menuEl3.addEventListener('MDCMenu:selected', function(evt) {
          var detail = evt.detail;
          lastSelected.textContent = 'Overflow Menu: "' + detail.item.textContent.trim() +
            '" at index ' + detail.index;
        });

        menuEl4.addEventListener('MDCMenu:selected', function(evt) {
          var detail = evt.detail;
          lastSelected.textContent = 'Context Menu: "' + detail.item.textContent.trim() +
            '" at index ' + detail.index;
        });

        [].slice.call(document.querySelectorAll('.mdc-list-item')).forEach(
          function(ele) {
            mdc.ripple.MDCRipple.attachTo(ele);
          });
      });
    </script>
  </body>
</html>
